using System.Collections.Generic;
using System.Linq;

namespace Comteck.Winforms.Templates {
  /// <summary>
  /// Excel模板
  /// </summary>
  public class ExcelTemplateHelper {
    /// <summary>
    /// 
    /// </summary>
    private static readonly List<ImportTemplateDto> importTemplateDtos = null;

    /// <summary>
    /// ctor
    /// </summary>
    static ExcelTemplateHelper() {
      importTemplateDtos = new List<ImportTemplateDto>();

      // 系统管理
      importTemplateDtos.Add(new ImportTemplateDto() { Id = EnumTemplateType.SaleOrder.ToString(), Name = "订单", Path = "/template/excel/订单-列排格式.xlsx" });
    }

    /// <summary>
    /// 查询全部的模板
    /// </summary>
    /// <returns></returns>
    public static List<ImportTemplateDto> GetAll() {
      return importTemplateDtos;
    }

    /// <summary>
    /// 根据主键查询模板信息
    /// </summary>
    /// <param name="id"></param>
    /// <returns></returns>
    public static ImportTemplateDto GetById(string id) {
      return GetAll().FirstOrDefault(x => x.Id == id);
    }
  }
}
